package com.linkstec.quartz.source;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.quartz.DisallowConcurrentExecution;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

/**
 * quartz示例定时器类
 *
 * @author Administrator
 *
 */
@DisallowConcurrentExecution
public class QuartzJobExample implements Job {

	private static final Logger logger = LogManager.getLogger();
    @Override
    public void execute(JobExecutionContext context) throws JobExecutionException {
        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) + "★★★★★★★★★★★");
        logger.info(context.getJobDetail().getJobDataMap().get("monitorRule"));
        logger.info(context.getJobDetail().getDescription());
        try {
			Thread.sleep(5000);
		} catch (InterruptedException e) {
			e.printStackTrace();
		}
    }
}